from multiprocessing import Pool
import subprocess

email_list = []
email_dic = {}


def read_write_file(path_a):
    with open(path_a, 'r', encoding='utf-8') as f1:
        for line in f1:
            rc_id = line.replace("@", "").replace(".", "").strip()
            email_list.append(rc_id)
            email_dic[rc_id] = line.strip()


def rclone_cmd(email):
    message = subprocess.getoutput("rclone lsd " + email + ":")
    if "Failed" in message:
        return
        # print("rclone ls " + email_id + ":")
        # print(message)
    print(email_dic.get(email))


if __name__ == '__main__':
    read_write_file("/pinbo/100_1.txt")
    with Pool(10) as p:
        p.map(rclone_cmd, email_list)
